

import time

from boto.s3.connection import S3Connection
from boto.s3.key import Key

class AWS:
    execfile(".keys.cfg") 
    
    def __init__(self):
        self.c = S3Connection(self.AWS_ID, self.AWS_KEY, is_secure=False)
        bs = self.c.get_all_buckets()
        bucket = None
        for b in bs:
            if b.name == self.BUCKET_NAME:
                bucket = b
        if not bucket:
            bucket = self.c.create_bucket(self.BUCKET_NAME)
        self.b = bucket
                                
    def get_iso_time(self, secs=3600):
        iso_time = time.strftime("%Y-%m-%dT%H:%M:%SZ", 
                                    time.gmtime(time.time()+secs))
        return iso_time
        

